﻿#ifndef _COIN_H_
#define _COIN_H_
#include "ui/CocosGUI.h"
#include "cocos2d.h"
#include "cocostudio/CocoStudio.h"
//金币类
class Coin : public cocos2d::ui::Widget{
public:
	Coin(cocos2d::Vec2 enemyPos, int coinNum, bool isGameCoin, bool isPerformWonders);
	static Coin* create(cocos2d::Vec2 enemyPos, int coinNum, bool isGameCoin = true, bool isPerformWonders = false);
	void loadUserInfo();
	bool init();
	void initCSBFile();//加载csb文件
	cocos2d::Vec2 getCoinPos()const {
		return coinPos;
	}
	cocos2d::Vec2 getCoinSize()const {
		return coinSize;
	}
	int getCoinNum() {
		if (isPerformWonders) {
			return coinNum / 20;
		}
		else if(!isGameCoin){
			return 100;
		} else {
			return coinNum;
		}
	}
	bool getIsGameCoin()const {
		return isGameCoin;
	}
	void runCoinAction(cocos2d::Vec2 pos);//动画
private:
	bool isGameCoin;
	bool isPerformWonders;
	cocos2d::Node* coinNode;
	cocos2d::Sprite* coinSp;
	cocos2d::Size size;
	cocos2d::Size coinSize;
	cocos2d::Vec2 coinPos;
	int coinNum;
};
#endif // !_COIN_H_



